<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "archive_section".
 *
 * @property int $id
 * @property int $number
 * @property string $name
 * @property string $description
 *
 * @property ArchiveItem[] $archiveItems
 */
class ArchiveSection extends \yii\db\ActiveRecord
{
    public $itemsCount;

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'archive_section';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['number'], 'integer'],
            [['name'], 'required'],
            [['description'], 'string'],
            [['name'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'number' => '№ раздела',
            'name' => 'Имя',
            'description' => 'Описание',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getArchiveItems()
    {
        return $this->hasMany(ArchiveItem::className(), ['id_section' => 'id']);
    }
}
